package com.tm.exception;

import com.tm.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @PROJECT_NAME: tm-wm-syb
 * @DESCRIPTION:
 * @USER: DELL
 * @DATE: 2023/4/3 18:54
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {



    @ExceptionHandler(BizeException.class)
    public R exception(BizeException e){
        e.printStackTrace();
        log.error("全局异常-->[{}]",e);
        return R.error(e.getCode(),e.getMsg());
    }



@ExceptionHandler(Exception.class)
    public R exception(Exception e){
        e.printStackTrace();
        log.error("全局异常-->[{}]",e);
    return R.error();
    }
}
